#region Usings
using System;
using Lib.Data.ORM.Entity;
using Lib.Data.ORM.EntityManagement;
#endregion

namespace BK.Entities
{
    [MappedEntity(TableName = "Payments")]
    public class PaymentEntity : BaseEntity<IdentifierInt>
    {
        #region Readonly & Static Fields
        private readonly IdentifierInt _accountId;
        private readonly IdentifierInt _categoryId;
        private readonly IdentifierInt _userId;
        #endregion

        #region C'tors
        public PaymentEntity()
        {
            _categoryId = new IdentifierInt();
            _accountId = new IdentifierInt();
            _userId = new IdentifierInt();
        }
        #endregion

        #region Instance Properties
        [MappedKey(IsPrimaryKey = true, IsIdentity = true, ValuePropertyName = "Id.Value")]
        public override IdentifierInt Id
        {
            get { return base.Id; }
        }

        [MappedKey(IsForeignKey = true, ValuePropertyName = "AccountId.Value")]
        public IdentifierInt AccountId
        {
            get { return _accountId; }
        }

        [MappedProperty]
        public decimal Amount { get; set; }

        [MappedKey(IsForeignKey = true, ValuePropertyName = "CategoryId.Value")]
        public IdentifierInt CategoryId
        {
            get { return _categoryId; }
        }

        [MappedProperty]
        public DateTime DateTime { get; set; }

        [MappedProperty]
        public string Description { get; set; }

        [MappedKey(IsForeignKey = true, ValuePropertyName = "UserId.Value")]
        public IdentifierInt UserId
        {
            get { return _userId; }
        }
        #endregion
    }
}